package com.feib.soeasy.service;

import java.util.Date;
import java.util.List;

import org.springframework.transaction.annotation.Transactional;

import com.feib.soeasy.model.FormatDefinition;
import com.feib.soeasy.model.Group;
import com.feib.soeasy.model.UploadFile;
import com.feib.soeasy.pagination.PaginatedList;
import com.feib.soeasy.pagination.QryDownloadFileList;


/**
 * @title (#)UploadFileService.java<br>
 * @description 使用者上傳紀錄邏輯介面<br>
 * @author Jimmy Liu<br>
 * @version 1.0.0 2010/11/25
 * @copyright Far Eastern International Bank Copyright (c) 2010<br>
 * @2010/11/14 create by Jimmy Liu<br>
 */
@Transactional(readOnly = true)
public interface UploadFileService {

    public List<UploadFile> queryUnConfirmByUploadFile(UploadFile uploadFile);

    /**
     * 更新放行結果
     * @param uploadFilePk 上傳檔案pk key
     * @param fileStatus 放行結果 3: 確認放行, 4: 不放行(表上傳資料有誤)
     * @author Leo Lee
     * @since 2010/11/27
     */
    @Transactional(readOnly = false)
    public void updateUploadFileStatus(Long uploadFilePk, Integer fileStatus);

    /**
     * 取得單筆上傳檔案資料
     * @param uploadFilePk 上傳檔pk
     * @return 上傳檔案 UploadFile
     * @author Leo Lee
     * @since 2010/11/25
     */
    @Transactional(readOnly = false)
    public UploadFile getUploadFileByPk(Long uploadFilePk);

    /**
     * 依據查詢物件與上傳日期起迄查詢上傳紀錄
     * @param uploadFile 查詢條件
     * @param uploadFrom 上傳日期起
     * @param uploadTo 上傳日期迄
     * @param paginationConfig 換頁條件
     * @return 查詢結果物件
     */
    public PaginatedList<UploadFile> queryByUploadFile(UploadFile uploadFile, Date uploadFrom, Date uploadTo, PaginatedList<UploadFile> paginationConfig);
    /**
     * 新增UploadFile 資料
     * @param uploadFile
     * @return
     */
    @Transactional(readOnly = false)
    public UploadFile add(UploadFile uploadFile);

    /**
     * 明細資料下載查詢
     * @param uploadFile 查詢條件:Group , FormatDefinitaion, FileName
     * @param uploadFrom 上傳日期起 (UploadFile.uploadDate)
     * @param uploadTo 	 上傳日期迄 (UploadFile.uploadDate)
     * @param paymentStatus 繳費狀態 (Payment.paymentStatus)
     * @return
     */
    public List<QryDownloadFileList> queryDownloadDetailFile(UploadFile uploadFile,
                    Date uploadFrom, Date uploadTo, Integer paymentStatus);
    
    /**
     * 檢核設定檔是否有上傳紀錄
     * @param formatDefinition
     * @return
     */
    public int countUploadFileByFormatDefinition(FormatDefinition formatDefinition);

    /**
     * 以帳單業者檢查是否有上傳紀錄
     * @param group
     * @return
     */
    public int countUploadFileByGroup(Group group);
}
